
<?php

$colname_tampil_member = "-1";
if (isset($_GET['user'])) {
  $colname_tampil_member = $_GET['user'];
}
mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tampil_member = sprintf("SELECT * FROM memberdb WHERE nama_user = %s", GetSQLValueString($colname_tampil_member, "text"));
$tampil_member = mysql_query($query_tampil_member, $sepolwan_connect) or die(mysql_error());
$row_tampil_member = mysql_fetch_assoc($tampil_member);
$totalRows_tampil_member = mysql_num_rows($tampil_member);

$colname_editdata = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_editdata = $_SESSION['MM_Username'];
}
mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_editdata = sprintf("SELECT * FROM memberdb WHERE email = %s", GetSQLValueString($colname_editdata, "text"));
$editdata = mysql_query($query_editdata, $sepolwan_connect) or die(mysql_error());
$row_editdata = mysql_fetch_assoc($editdata);
$totalRows_editdata = mysql_num_rows($editdata);
?>
<?php if ($totalRows_tampil_member > 0) { // Show if recordset not empty ?>
  <div style="border:1px solid #CCC; width:98%; padding:1%; background:#F5F5F5"><span id="judul"><strong>Edit My Profile</strong></span></div>
  <?php } // Show if recordset not empty ?>
<p>
  <?php if ($_SESSION['MM_Username']<>"" and $_SESSION['MM_Username']==$row_tampil_member['email']) { ?>
<form action="<?php 
 echo curPageURL();  ?>" method="post" enctype="multipart/form-data" name="editdatauser" id="editdatauser">
  <table align="center">
  <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Username :</td>
      <td><div style="padding:5px;"><?php echo htmlentities($row_editdata['nama_user'], ENT_COMPAT, ''); ?></div></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Full name :</td>
      <td><input type="text" name="full_name" value="<?php echo htmlentities($row_editdata['full_name'], ENT_COMPAT, ''); ?>" size="60" /></td>
    </tr>
    
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Foto profile :</td>
      <td><label for="foto_profile"></label>
      <input type="file" name="foto_profile" id="foto_profile" />
      <i>ukuran(230x230)</i></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Cover profile :</td>
      <td><label for="cover_profile"></label>
      <input type="file" name="cover_profile" id="cover_profile" />
      <i>ukuran(950x300)</i></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">About :</td>
      <td><textarea name="about" cols="90" rows="5" style="resize:none"><?php echo htmlentities($row_editdata['about'], ENT_COMPAT, ''); ?></textarea></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Tempat :</td>
      <td><input type="text" name="tempat" value="<?php echo htmlentities($row_editdata['tempat'], ENT_COMPAT, ''); ?>" size="60" /></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="top" nowrap="nowrap">Website :</td>
      <td><input type="text" name="website" value="<?php echo htmlentities($row_editdata['website'], ENT_COMPAT, ''); ?>" size="60" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Simpan Perubahan" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="editdatauser" />
</form><?php } else { ?>Akses Terlarang<?php } ?>
</p>

<?php
mysql_free_result($editdata);

mysql_free_result($tampil_member);
?>
